import json
# 阿里云上接收的数据转存到txt中
def send(string):
    xiugai = {}
    with open('D:\\share\\send.txt', 'r+') as f:
        data = f.read()
        # 转换格式为字典类型
        dict = json.loads(data)
        dict["count"] = (dict["count"]+1) % 10
        dict["data"] = string
        xiugai = str(dict)
        f.close()
    with open('D:\\share\\send.txt', 'w') as f:
        xiugai = xiugai.replace('\'', "\"")
        f.write(xiugai)
if __name__ == "__main__":
    send('w')
